<?php
include  '../loginCheck.php';
include  '../Util.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>Contacts</title>
        <link rel="stylesheet" type="text/css" href="view.css" media="all"/>
        <script type="text/javascript" src="view.js"></script>

    </head>
    <body id="main_body" >

        <img id="top" src="top.png" alt=""/>
        <div id="form_container">

            <?php

            $link = Util::getLink();

            $query = sprintf(Util::$select_jornakDestination,
                mysql_real_escape_string("5")
            );

            $result = mysql_query($query);

            if (!$result) {
                die('Could not query:' . mysql_error() . '<br>' . $query);
            }

            $i = 0;

            while ($row = mysql_fetch_assoc($result)) {
                $textID[$i] = $row['textid'];
                break;
            }
            if ($textID != null) {

                $query = sprintf(Util::$select_jornakText,
                    mysql_real_escape_string($textID[$i])
                );

                $result = mysql_query($query);

                if (!$result) {
                    die('Could not query:' . mysql_error() . '<br>' . $query);
                }
            }

            $row = mysql_fetch_assoc($result)

                ?>

            <h1>
                <?php
                include  'menu.php';
                ?>
            </h1>
            <form id="form_144190" class="appnitro"  method="post" action="../adminResolveContacts.php">
                <div class="form_description">
                    <h2>Contacts</h2>
                    <p>You are editing section contacts. You can use html tags.</p>
                </div>
                <ul >

                    <li id="li_1" >
                        <label class="description" for="element_1">Headline </label>
                        <div>
                            <input id="element_1" name="element_1" class="element text medium" type="text" maxlength="255" value="<?php echo stripslashes($row['header']);?>"/>
                        </div><p class="guidelines" id="guide_1"><small>Headline.</small></p>
                    </li>		<li id="li_2" >
                        <label class="description" for="element_2">Contact text</label>
                        <div>
                            <textarea id="element_2" name="element_2" class="element textarea medium"><?php echo stripslashes($row['text']);?></textarea>
                        </div> <p class="guidelines" id="guide_1"><small>Contact text.</small></p>
                    </li>

                    <li class="buttons">
                        <input type="hidden" name="form_id" value="144190" />

                        <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
                    </li>
                </ul>
                <input type="hidden" name="form_type" value="5" />
            </form>
            <div id="footer">

            </div>
            <?php

            Util::closeLink($link);

            ?>
        </div>
        <img id="bottom" src="bottom.png" alt=""/>
    </body>
</html>